<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/classes/DBHelper.class.jsp" %>
<%@ include file="/classes/CommonHelper.class.jsp" %>
<%@ page contentType="text/html; charset=ISO-8859-1" %>
<%
	
	String chid = getParameter(request,"chid");

	String sql = //"";
		"select t1.manuscript_id"+
		"  from cms_manuscript t1"+
		" where t1.channel_id = '"+chid+"'"+
		"   and to_char(t1.published_time / (1000 * 60 * 60 * 24) + to_date('1970-01-01 08:00:00', 'yyyy-mm-dd hh24:mi:ss '), 'yyyy-mm-dd hh24:mi:ss ') like '%2014-07%'"+
		" union all"+
		" select t1.manuscript_id"+
		"  from cms_manuscript t1, cms_carbon_copy t2"+
		" where t1.manuscript_id = t2.manuscript_id"+
		"   and to_char(t1.published_time / (1000 * 60 * 60 * 24) + to_date('1970-01-01 08:00:00', 'yyyy-mm-dd hh24:mi:ss '), 'yyyy-mm-dd hh24:mi:ss ') like '%2014-07%'"+
		"   and t2.cc_target_channel_id = '"+chid+"'";
	
	List<Map<String,Object>> list = queryForList(sql);
	int count = 0;
	for(Map<String,Object> m : list){
		String mid = (String)m.get("manuscript_id");
		String insertSql = "insert into nrbz_cy (MID,chid,un) values (?,?,'zhuofei')";
		Object[] params = new Object[]{mid,chid};
		//executeUpdate(insertSql,params);
		count++;
	}
	System.out.println(count);

%>
